//
//  UBaseNavPopView.m
//  s.
//
//  Created by fanshijian on 2022/9/1.
//  Copyright © 2022 J. All rights reserved.
//

#import "UBaseNavPopView.h"

@interface JYPopBarView ()

@property (weak, nonatomic) UIImageView *closeBtn;

@end

@implementation JYPopBarView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self titleLab];
        self.backgroundColor = [UIColor whiteColor];
        [self fsj_setCorner:UIRectCornerTopLeft|UIRectCornerTopRight radius:16];

    }
    return self;
}

- (UILabel *)titleLab {
    if (!_titleLab) {
        UILabel *obj = [UILabel new];
        [self addSubview:_titleLab = obj];
        [obj mas_makeConstraints:^(MASConstraintMaker *make) {
            kMakeCenterXV(0);
            kMakeTV(10);
            kMakeWHV(260, 30);
        }];
        obj.textColor = [UIColor blackColor];
        obj.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLab;
}



@end


@interface UBaseNavPopView ()

@end

@implementation UBaseNavPopView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = self.containerColor?S_HexColor(self.containerColor):[UIColor clearColor];

    }
    return self;
}

- (CGFloat)jy_bar_h {return 50;}

- (NSString *)containerColor {return @"#FFFFFF";}

- (JYPopBarView *)bar {
    if (!_bar) {
        
        JYPopBarView *obj = [[JYPopBarView alloc] initWithFrame:CGRectMake(0, -self.jy_bar_h, kScreenWidth, self.jy_bar_h)];
        [self addSubview:_bar = obj];
        [obj mas_makeConstraints:^(MASConstraintMaker *make) {
            kMakeLRV(0);
            kMakeTV(-self.jy_bar_h);
            kMakeHV(self.jy_bar_h);
        }];
//        obj.closeAction = kMsgForward(@"closeAction", WKProxy(self));
    }
    return _bar;
}

#pragma mark - EVENT
- (void)closeAction {
    if (self.eventTransmissionBlock) {
        self.eventTransmissionBlock(nil, 0);
    }
}

@end
